package com.liu.mybatisPlus.q.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liu.common.content.RedisKeyInterface;
import com.liu.common.interfases.PrintLogInterface;
import com.liu.common.utils.QQClientUtils;
import com.liu.mybatisPlus.q.entity.base.QGroupUser;
import com.liu.mybatisPlus.q.mapper.QGroupUserMapper;
import com.liu.mybatisPlus.q.service.QGroupUserService;
import jakarta.annotation.Resource;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.concurrent.TimeUnit;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author LiuChengLong
 * @since 2025-04-01
 */
@Service
public class QGroupUserServiceImpl extends ServiceImpl<QGroupUserMapper, QGroupUser> implements QGroupUserService {

    @Resource
    private RedisTemplate<String, String> redisTemplate;

    @Override
    @PrintLogInterface
    public void login(Long groupId, Long userId) {
        redisTemplate.opsForValue().set(RedisKeyInterface.USER_LOGIN_WEB_REDIS_KEY + groupId + "" + userId, "0", 1, TimeUnit.DAYS);
        QQClientUtils.sendMsg("请在QQ中回复【确认登录】进行登录网页warframeBot", userId, groupId, false);
    }

}
